#include <initializer_list>
#include <iostream>

template <typename T>

decltype(auto) sum(const std::initializer_list<T> &v) {
  T s = 0;
  for (const auto &i : v) {
    s += i;
  }

  return s;
}

int main(int argc, char *argv[]) {
  int r = sum({1, 2, 3, 4, 5, 6});
  std::cout << "result: " << r << "\n";

  return 0;
}
